<template>
    <el-dropdown>
        <span class="el-dropdown-link">
          个人中心
          <el-icon class="el-icon--right">
<!--                <arrow-down />-->
          </el-icon>
        </span>
        <template #dropdown>
            <el-dropdown-menu>
                <el-dropdown-item>个人信息</el-dropdown-item>
                <el-dropdown-item @click="singOut()">退出登录</el-dropdown-item>
            </el-dropdown-menu>
        </template>
    </el-dropdown>
</template>

<script setup>
    //退出登录
    import {userInfoStore} from "../store/user";
    import Router from "../router";

    function singOut() {
        const store = userInfoStore()
        //清空token信息
        store.token = '';
        store.userInfo = '';
        //跳转到登录页面
        Router.push('/login')
    }
</script>

<style scoped>
    .el-dropdown{
        line-height: unset !important;
    }
</style>